package com.sc.nft.service;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sc.nft.entity.UserEcologyPoints;
import com.sc.nft.entity.vo.UserPointsDetailsStatisticsVO;
import com.sc.nft.entity.vo.ecology.*;
import com.sc.nft.entity.vo.merchantPledgeTask.AdminEcologyPointsDataVO;
import com.sc.nft.enums.EcologyIncomeTypeEnum;
import com.sc.nft.enums.EcologyPointsEnum;
import com.sc.nft.enums.UserEcologyUsableAmountUpperLimitDetailTypeEnum;

import java.math.BigDecimal;
import java.util.Date;

public interface UserEcologyPointsService {

    /**
     * 获取用户的生态积分详情
     * @param userId
     * @return
     */
    UserEcologyPoints getOneByUserId(Long userId);

    /**
     * 扣除燃料
     * @param userId
     * @param amount
     * @return
     */
    Boolean subAmount(Long userId, BigDecimal amount, EcologyPointsEnum type,String remark);

    /**
     * 添加燃料
     * @param userId
     * @param amount
     */
    Boolean addEcologyPoints(Long userId, BigDecimal amount,EcologyPointsEnum type,String remark);
    /**
     * 添加燃料
     * @param userId
     * @param amount
     */
    Boolean addEcologyPointsAndSubLimit(Long userId, BigDecimal amount,EcologyPointsEnum type,String remark);
    /**
     * 添加燃料(动态)
     * @param userId
     * @param amount
     */
    Boolean addDynamicStateEcologyPoints(Long userId, BigDecimal amount,EcologyPointsEnum type,EcologyIncomeTypeEnum incomeType,String remark,String daoIncomeName);

    /**
     * 获取燃料总量
     * @param userTel
     * @param pageNo
     * @param pageSize
     * @return
     */
    Page<AdminEcologyPointsUserPageVO> getUserPage(String userTel, Integer pageNo, Integer pageSize);

    /**
     * 编辑用户燃料
     * @param id
     * @param isAdd
     * @param amount
     * @param remark
     */
    void editUserPoints(Long id, Boolean isAdd, String amount, String remark);

    /**
     * 获取用户燃料记录详情
     * @param type
     * @param startTime
     * @param endTime
     * @param pageNo
     * @param pageSize
     * @return
     */
    Page<AdminEcologyPointsUserPageDetailsVO> getUserDetailsPage(Long userId,EcologyPointsEnum type, Date startTime, Date endTime, Integer pageNo, Integer pageSize);

    /**
     * 获取用户燃料记录详情
     * @param userTel
     * @return
     */
    UserPointsDetailsStatisticsVO userPointsDetailsStatistics(String userTel);

    /**
     * 额度记录
     * @param userId
     * @param daoName
     * @param startTime
     * @param endTime
     * @param pageNo
     * @param pageSize
     * @return
     */
    Page<AdminQuotaLogVO> quotaLog(Long userId, String daoName, String collectionName, Date startTime, Date endTime, Integer pageNo, Integer pageSize);

    /**
     * 过期记录
     * @param userId
     * @param incomeType
     * @param startTime
     * @param endTime
     * @param pageNo
     * @param pageSize
     * @return
     */
    Page<AdminExpiredRecordsVO> expiredRecords(Long userId, EcologyIncomeTypeEnum incomeType, Date startTime, Date endTime, Integer pageNo, Integer pageSize);

    /**
     * 用户燃料上限初始化
     */
    void initUsableAmountLimit();

    /**
     * 后台获取统计数据
     * @return
     */
    AdminEcologyPointsDataVO getEcologyPointsData();

    /**
     * 转账到市值账号
     * @param userId
     * @param daoId
     * @param transferAmount
     */
    void transferMarketValueAccount(Long userId, Long daoId, BigDecimal transferAmount);

    /**
     * 用户燃料上限明细
     * @param userId
     * @param startTime
     * @param endTime
     * @param pageNo
     * @param pageSize
     * @return
     */
    Page<AdminuserEcologyUsableAmountUpperLimitDetailPageVO> userEcologyUsableAmountUpperLimitDetailPage(Long userId, Date startTime, Date endTime, Integer pageNo, Integer pageSize);

    /**
     * 添加用户燃料上限
     * @param userId
     * @param usableAmountUpperLimit
     * @return
     */
    void addUsableAmountUpperLimitByUserId(Long userId, BigDecimal usableAmountUpperLimit, UserEcologyUsableAmountUpperLimitDetailTypeEnum type,String typeName);

    /**
     * 燃料兑换nft
     * @param toUserId
     * @param daoId
     * @param applyNum
     * @param collectionId
     * @param needPoints
     */
    void pointApplyExchange(Long toUserId, Long daoId, Integer applyNum, Long collectionId, BigDecimal needPoints);
}
